import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
import { LoginFrameService } from './login-frame.service';
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
import { Observable } from 'rxjs';
import Singleton from "../services/singleton"

@Component({
  selector: 'app-login-frame',
  templateUrl: './login-frame.component.html',
  styleUrls: ['./login-frame.component.scss']
})
export class LoginFrameComponent implements OnInit {

  constructor(
    private readonly loginFrameService: LoginFrameService,
    private route: ActivatedRoute,
    private router: Router,
    private ref: ChangeDetectorRef,
  ) { }
  singleton_username: Singleton;
  username: string;
  password: string;
  url: string[] = [];
  status: string = 'default';

  ngOnInit(): void {
    
  }
  postNameAndPas() {
    // this.username = 'sysu';
    // this.password = 'sysu';
    // this.loginFrameService
    //   .postLogin(this.username, this.password)
    //   .subscribe(data => {
    //     if (data.data == 'Success') {
    //       this.router.navigate(['../realtime-monitoring']);
    //     } else if (data.data == 'Fail') {
    //       this.status = 'Fail';
    //       this.ref.detectChanges();
    //     }
    //   });
    // this.username = 'huawei';
    this.singleton_username = Singleton.getInstance();
    this.singleton_username.setUserName(this.username);
    this.router.navigate(['../bank-account']);
  }

}
